
#ifndef __CCEXTENSION_H__
#define __CCEXTENSION_H__

#include "cocos2d.h"


namespace   cocos2d {

//static creation function macro
//c/c++ don't support object creation of using class name
//so, all classes need creation method.
#define DECLEAR_TRANSITIONWITHDURATION(_Type)\
    static _Type* transitionWithDuration(ccTime t, CCScene* scene);

//class CCActionInterval;
//class CCNode;


/** @brief CCGravityGrid action */
class CCGravityGrid : public CCTiledGrid3DAction
{
public :
	/** initializes the action with the number of rows to split and the duration */
	bool initWithGrid(int nGrid, ccTime duration);

	//virtual CCObject* copyWithZone(CCZone* pZone);
	virtual void update(ccTime time);
	virtual void update3d(ccTime time);
	virtual void startWithTarget(CCNode *pTarget);

public:
	/** creates the action with the number of rows to split and the duration */
	static CCGravityGrid* actionWithGrid(int nGrid, ccTime duration);

protected:
	int m_nGrid;
	CCSize m_winSize;

	CCPoint BlackHolePos;
	float MaxDist;

	ccVertex3F BlackHolePos3d;
	float MaxDist3d;
};


/** @brief CCTransitionGravityGrid:
Grid actract by a point like blackHole
*/
class CCTransitionGravityGrid : public CCTransitionSplitCols
{
public:
	CCTransitionGravityGrid();
	virtual ~CCTransitionGravityGrid();

	virtual CCActionInterval* action(void);

public:
    DECLEAR_TRANSITIONWITHDURATION(CCTransitionGravityGrid)
};

}


#endif